﻿// My methods here.
//-----------------------------------------------------------------------
// <Copyright file=KhuyenMai company=DHPD>
// Copyright (c) DHPD Corporation (http://dhpd.edu.vn). All rights reserved.
// </copyright>
// <author>HP</author>
//-----------------------------------------------------------------------


using System;
using System.Collections.Generic;
using KM.DAT;
using KM.ENT;
using KM.Models;

namespace KM.BUS
{
    /// <summary>
    /// This is busKhuyenMai class
    /// </summary>

    public class busKhuyenMai
    {
        public busKhuyenMai()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        public List<entKhuyenMai> getAllByLoaiKhuyenMai(int Id, int thanhpho,int price, string q, ref PagingInfoModel page)
        {
            datKhuyenMai datKM = new datKhuyenMai();
            List<entKhuyenMai> lst = new List<entKhuyenMai>();
            lst = datKM.getAllByLoaiKhuyenMai(Id, thanhpho,price,q, ref page);
            return lst;
        }
        public void createEdit(entKhuyenMai entKM)
        {
            datKhuyenMai datKM = new datKhuyenMai();
            datKM.createEdit(entKM);
        }
        public void createEdit(entKhuyenMai entKM, int LoaiKhuyenMaiId)
        {
            datKhuyenMai datKM = new datKhuyenMai();
            datKM.createEdit(entKM, LoaiKhuyenMaiId);
        }
        public List<entKhuyenMai> getKhuyenMaiHot(int thanhpho,ref PagingInfoModel page)
        {
            datKhuyenMai datKM = new datKhuyenMai();
            List<entKhuyenMai> lst = new List<entKhuyenMai>();
            lst = datKM.getKhuyenMaiHot(thanhpho, ref page);
            return lst;
        }
        public List<entKhuyenMai> getMyKhuyenMai(int mykhuyenmai)
        {
            datKhuyenMai datKM = new datKhuyenMai();
            return datKM.getMyKhuyenMai(mykhuyenmai);

        }
        public List<entKhuyenMai> getAll(ref PagingInfoModel page)
        {
            datKhuyenMai datKM = new datKhuyenMai();
            List<entKhuyenMai> lst = new List<entKhuyenMai>();
            lst = datKM.getAll(ref page);
            return lst;
        }
        public List<entKhuyenMai> getAllByForeignKey(int Id,byte type, ref PagingInfoModel page)
        {
            datKhuyenMai datKM = new datKhuyenMai();
            List<entKhuyenMai> lst = new List<entKhuyenMai>();
            lst = datKM.getAllByForeignKey(Id, type, ref page);
            return lst;
        }
        public List<entKhuyenMai> getAllByForeignKey(int Id, byte type, ref PagingInfoModel page, byte mykhuyenmai)
        {
            datKhuyenMai datKM = new datKhuyenMai();
            List<entKhuyenMai> lst = new List<entKhuyenMai>();
            lst = datKM.getAllByForeignKey(Id, type, ref page, mykhuyenmai);
            return lst;
        }
        public entKhuyenMai getInfo(int Id)
        {
            datKhuyenMai datKM = new datKhuyenMai();
            entKhuyenMai entKM = new entKhuyenMai();
            entKM = datKM.getInfo(Id);
            return entKM;
        }
        public bool delete(int Id, byte type)
        {
            datKhuyenMai datKM = new datKhuyenMai();
            datKM.delete(Id, type);
            return true;
        }
        public bool checkLink(string link)
        {
            entKhuyenMai entKM = new entKhuyenMai();
            datKhuyenMai datKM = new datKhuyenMai();
            entKM = datKM.checkLink(link);
            if (entKM.KhuyenMaiId == 0)
            {
                return true;
            }
            return false;
        }
    }
}
